import org.w3c.dom.css.Counter;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2024-12-13
 * Time: 17:28
 */
class Count {
    public int count = 0;
    synchronized public void increase() {
        count++;

    }
}



public class JDBCDemo8 {
    public static void main(String[] args) throws InterruptedException {

       Count count = new Count();
        Thread t1 = new Thread(() ->{
            for (int i = 0; i < 5000; i++) {
                count.increase();
            }
        });

        Thread t2 = new Thread( ()-> {
            for (int i = 0; i < 5000; i++) {
                count.increase();
            }
        });

        t1.start();
        t2.start();

        t1.join();
        t2.join();
    }
}
